<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>:eq</title>
        <link type="text/css" rel="stylesheet" href='../../css/c1.css'>
        <style>
            *{
                margin: 0 auto;
                padding: 0;
            }
            p{
                padding: 5px 10px;
            }
        </style>
        <script src="../../work/jquery-1.12.4.min.js"></script>
        <script>
            jQuery(function ($) {
                $("#btn1",".code").click(function () {
                    $("tr:eq(0)").css({backgroundColor:'red'});
                });

            });
        </script>
    </head>
    <body>
    <div class="title">:eq</div>
    <p>匹配一个给定索引值的元素,参数是从零开始</p>
    <div class="title">代码示例</div>
    <div class="code">
                        <pre>

                            &lt;script&gt;
                                jQuery(function ($) {
                                    $("#btn1",).click(function () {
                                        $(<span>"tr:eq(0)"</span>).css({backgroundColor:'red'}); //<span>查找第一行</span>
                                    });
                                });
                           &lt;/script&gt;

                          &lt;table border="1"&gt;
                                &lt;tr&gt;&lt;td&gt;Header 1&lt;/td&gt;&lt;/tr&gt;
                                &lt;tr&gt;&lt;td&gt;Value 1&lt;/td&gt;&lt;/tr&gt;
                                &lt;tr&gt;&lt;td&gt;Value 2&lt;/td&gt;&lt;/tr&gt;
                          &lt;/table&gt;
                          &lt;button id="btn1" style="margin: 10px;"&gt;点击查看效果&lt;/button&gt;
                        </pre>
    </div>
    <div class="title">代码示例</div>
    <div class="code">
        <table border="1">
            <tr><td>Header 1</td></tr>
            <tr><td>Value 1</td></tr>
            <tr><td>Value 2</td></tr>
        </table>
        <button id="btn1" style="margin: 10px;">点击查看效果</button>
    </div>
    </body>
</html>